<template>
  <div id="app">
    <headerView
      :title="title"
      :link="link"
      ref="headerView"
      :tableName="tableName"
    ></headerView>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
    <footer>
      
      <span> 版本：v{{ version }} <a href="https://gitee.com/justinalucard/hexagram/releases" v-if="showCheckVersion"><svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-reset"></use>
          </svg>检查更新</a></span>
          <span>备案编号：<a href="https://beian.miit.gov.cn/">沪ICP备2024049943号</a>
          </span>
          <span><a href="https://beian.mps.gov.cn/#/query/webSearch?code=31011302007619" rel="noreferrer" target="_blank"><svg class="icon" aria-hidden="true" style="font-size: 2.2vmin">
            <use xlink:href="#icon-police"></use>
          </svg> 沪公网安备31011302007619</a></span>
      <span>支持软件：<a :href="homePage">捐赠作者</a></span>
    </footer>
    <div id="tip"><span class="phone">📱</span> 请将手机横屏后使用</div>
  </div>
</template>

<script>
import headerView from "./components/header.vue";
import config from "../package.json";
import runInApp from "./core/run-in-app";
export default {
  name: "App",

  computed: {
    title() {
      return this.$route.meta.logoName;
    },
    link() {
      return this.$route.path == "/" ? "/plumagram" : "/";
    },
    homePage() {
      return `https://gitee.com/justinalucard/hexagram/releases/tag/v${config.version}`;
    },
    version() {
      return config.version;
    },
    tableName() {
      return this.$route.meta.tableName;
    },
    showCheckVersion(){
      return runInApp.is();
    }
  },
  mounted() {
    const path = localStorage.getItem("hexagramHomePage");
    if (path && path != this.$route.path) {
      this.$router.replace(path);
    }
  },
  components: {
    headerView,
  },
};
</script>

<style lang="scss">
@import url("./assets/scss/style.css");
#app {
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  // padding-bottom: 2vmin;
}
footer {
  display: flex;
  justify-content: space-around;

  padding: 1vmin 4vmin;
  * {
    font-size: 2vmin;
  }
  a{
    text-decoration: none;
  }
}

#tip{
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  font-size: 6vw;
  height: 100vh;
  width: 100vw;
  flex-direction: column;
  background-color: var(--bg-color);
  
}
.phone {
    font-size: 20vw;
    animation: rotate 2s infinite;
    animation-direction: alternate-reverse;
    animation-timing-function: linear;
  }
</style>
